home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / UserFunction Samples / CheckTgtFreeSpace Sample / CheckTgtUserFunction.r < prev    next >
Encoding:
Text File  |  1993-06-15  |  6.7 KB  |  182 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: User Function to check for free target disk space
  6.  *
  7.  *    File:        CheckTgtUserFunction.r -    Rez Source
  8.  *
  9.  *    by:            Rich Kubota 9/1/92
  10.  *
  11.  *    Copyright © 1991 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  *
  16.  * Install application "TheProgram" into the folder "Root":Installed Application.
  17.  * It demonstrates both Easy and Custom Installation.  For the Easy Installation
  18.  * it checks for a specific nubus card and will not do the installation
  19.  * if it is not there.  Note that TheProgram can still be installed via a custom
  20.  * installation if the user so chooses (to prevent this you need to preclude custom
  21.  * installation).
  22.  *----------------------------------------------------------------------------*/
  23.  
  24. #include "Types.r"                    /* for the ICON resource */
  25. #include "InstallerTypes.r"
  26.  
  27. /* After you have created the UserFunction.rsrc file you can build and complete
  28. the script with the following lines:
  29. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  30. # or set up folders with the same names and contents as the floppies
  31. # put these folders in the same folder as the script or at the root directory of same disk
  32.  
  33.     rez -o "CheckTgtUserFunction" -t 'bbkr' -c 'bbkr' "CheckTgtUserFunction.r"
  34.     setfile -a i "CheckTgtUserFunction"        #mark Inited
  35.     scriptcheck -p "CheckTgtUserFunction"
  36. */
  37.  
  38. /* Definition for the user function */
  39. #define UserFunctionID            1500
  40.  
  41. /* bring the user function code resource into the installer doc... */
  42. INCLUDE    "CheckTgtFreeSpace.rsrc" 'infn' (1001) AS 'infn' (UserFunctionID, $$Attributes);
  43.  
  44. /* put a 0 in the creation date field of source 'infs' to have ScriptCheck bypass setting
  45.     the date */
  46. #define kDontSetDate            0x00
  47.  
  48. /* check for 17M free memory */
  49. #define kMemoryRequired            0x01100000
  50.  
  51. /* Definitions for the rules */
  52. #define rlUserFun                1000
  53. #define    rInsufficientSpace        1001
  54.  
  55. /* Definitions for the file spec atoms (specifications for source and destination files) */
  56. #define fsSourceProgram            2000
  57. #define fsTargetProgram            2001
  58.  
  59. /* This is the name of the source disk */
  60. #define ProgramDisk "Program Disk:"
  61.  
  62. /* where we want to install our file. */
  63. #define TargetPath    ":Installed Application:"
  64.  
  65. /* Definition for the package. */
  66. #define pkTheProgram            3000
  67.  
  68. /* Definition for the file atom */
  69. #define faProgram                4000
  70.  
  71. /* Definition for the package comment resource */
  72. #define cmtTheProgram            5000
  73.  
  74. /* September 1, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  75. /* this value to a LongInt seconds value needed by the Installer. */
  76. #define currentReleaseDate        9011992        
  77. #define currentVersion            0x101     /* Version 1.0.1 goes in the 'icmt' rsrc */
  78.  
  79. #define iconTheProgram            5100
  80.  
  81. /************************** Easy Install Rule resources **********************************/
  82. resource 'infr' (1) {
  83.     format0  {{
  84.         pickFirst,    {rlUserFun, rInsufficientSpace},     /* Select only one of these rules */
  85.     }};
  86. };
  87.  
  88. resource 'inrl' (rlUserFun) {
  89.     format0 {{
  90.         /* If the system has my board, then add the package */
  91.         checkUserFunction {UserFunctionType, UserFunctionID, kMemoryRequired},
  92.         addUserDescription {"Click Install button to install\n"}, /* message to appear in Easy Install screen */
  93.         addUserDescription {"• TeachText\n"},    /* message to appear in Easy Install screen */
  94.         addPackages {{pkTheProgram}}            /* we're installing the program */
  95.     }};
  96. };
  97.  
  98. resource 'inrl' (rInsufficientSpace) {
  99.     format0 {{
  100.         /* This error message will be displayed on the Easy Install screen if this rule */
  101.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  102.         
  103.         reportVolError {"To do the installation you need\n\n"},
  104.         reportVolError {"17M free on the target hard disk\n"}
  105.     }};
  106. };
  107.  
  108. /***************************** Package Resources ************************************************/
  109. resource 'inpk' (pkTheProgram) {
  110.     format0 {
  111.         ShowsOnCustom,                 /* Package appears in the Custom Install display */
  112.         Removable,                    /* Package can be removed */
  113.         dontForceRestart,            /* no need to restart */
  114.         cmtTheProgram,                 /* package's 'icmt' resource id */
  115.         0,                            /* Package size (filled in by ScriptCheck) */
  116.         "TheProgram", {                /* package name for package that shows on custom */
  117.             'infa', faProgram;
  118.         }
  119.     }
  120. };
  121.  
  122. /***************************** Comments ************************************************/
  123. resource 'icmt' (cmtTheProgram) {
  124.     currentReleaseDate,
  125.     currentVersion,
  126.     iconTheProgram,
  127.     "This package contains TheProgram. "
  128. };
  129.  
  130. resource 'ICON' (iconTheProgram) {
  131.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  132.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  133.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  134.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  135.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  136.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  137.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  138.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  139. };
  140.  
  141.  
  142. /********************************************* File Specs ******************************************/
  143. /* Source File Specs */
  144. resource 'infs' (fsSourceProgram) {
  145.     'APPL',                                /* File Type */
  146.     'ttxt',                                /* Creator */
  147.     kDontSetDate,                        /* ScriptCheck leaves creation date field blank*/
  148.     noSearchForFile,                    /* Do not search the source disk for the file */
  149.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  150.     ProgramDisk"TeachText"                /* Path to the file */
  151. };
  152.  
  153. /* Target File Specs */
  154. resource 'infs' (fsTargetProgram) {
  155.     'APPL',                                /* File Type */
  156.     'ttxt',                                /* Creator */
  157.     0,                                    /* creation date not needed for target file specs */
  158.     noSearchForFile,                    /* Do not search the target disk for the file */
  159.     TypeCrMustMatch,                    /* not needed for target file specs */
  160.     TargetPath"TeachText"                /* destination Path */
  161. };
  162.  
  163. /******************************************** File Atoms ************************************************/
  164. resource 'infa' (faProgram) {
  165.     format0 {
  166.         delRemove,                        /* Delete the file if remove (option-custom) is clicked    */
  167.         delInstall,                     /* Delete the target before copying new one */
  168.         copy,                             /* Copy the file to the destination */
  169.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  170.         noKeepExisting,                 /* Always replace an existing copy */
  171.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  172.         rsrcFork, dataFork,                /* Copy both forks of the file */
  173.         fsTargetProgram,                /* TARGET file spec for this file */
  174.         fsSourceProgram,                 /* SOURCE file spec for this file */
  175.         0,                                /* atom size (filled in by ScriptCheck) */
  176.         ""                                /* Atom Description (Installer will use file name) */
  177.     };
  178. };
  179.  
  180.  
  181.  
  182.